package com.sqy.controller;

import com.sqy.entity.Icons;
import com.sqy.exception.ImoocMallExceptionEnum;
import com.sqy.service.IconsService;
import com.sqy.utlis.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Icons")
@Api(tags = "图标列表")
public class IconsController {

    @Autowired
    IconsService iconsService;


    @PostMapping("/add")
    @ApiOperation("添加图标")
    public ApiResult addIcons(@RequestBody Icons icons){

        boolean save = iconsService.save(icons);

        if(save){
            return  ApiResult.success();
        }
        return  ApiResult.error(ImoocMallExceptionEnum.ADD_FAIL);
    }
}
